<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$return['feelog_status']=$this->feelog_status;
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['title']){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$params2['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
		$workerid=pdo_getall('jy_yxw_worker',$params2,array('title','id'),'id');
		if($workerid){
			$workerid=array_keys($workerid);
		}else{
			$workerid=-1;
		}
		$params['workerid']=$workerid;
	}
	if($_RQ['status']){
		$params['status']=$_RQ['status'];
		$return['params']['status']=$_RQ['status'];
	}
	if(!empty($_RQ['y']) && !empty($_RQ['m'])){
		$params['month']=$_RQ['y'].'-'.$_RQ['m'];
	}elseif(!empty($_RQ['y'])){
		$params['month like']=$_RQ['y'];
	}
	if(!empty($_RQ['y'])){
		$return['params']['y']=$_RQ['y'];
	}
	if(!empty($_RQ['m'])){
		$return['params']['m']=$_RQ['m'];
	}
	if(empty($_RQ['y']) && empty($_RQ['m'])){
		$yesyue = mktime(0,0,0,date('m')-1,1,date('Y'));
		$params['month']=date('Y-m',$yesyue);
		$return['params']['y']=date('Y',$yesyue);
		$return['params']['m']=date('m',$yesyue);
	}
	$orderby=array();
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_yxgz_feelog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	foreach($list as &$item){
		$item['feeinfo']=json_decode($item['feeinfo'],true);
	}
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'export'=>'export',
		'tabs'=>array(
			array('op'=>'list','title'=>'薪资表列表'),
			array('op'=>'uplog','title'=>'生成上月薪资'),
		),
		'list'=>array('data'=>'list','tip'=>'[温馨提示]：<red>默认只显示上月薪资表</red>；生成薪资表后，员工/主管可以手机端录入考勤次数等！最终会生成考勤奖励！','edit'=>false,'list'=>array(
			array('name'=>'workerid','title'=>'员工','type'=>'select','options'=>'workers'),
			array('name'=>'groupid','title'=>'部门','type'=>'select','options'=>'groups'),
			array('name'=>'group2id','title'=>'职位','type'=>'select','options'=>'groups'),
			array('name'=>'allkaoqingday','title'=>'总考勤天数','type'=>'string'),
			array('name'=>'kaoqingday','title'=>'出勤天数','type'=>'string'),
			array('name'=>'feeinfo.jifee','title'=>'基本工资','type'=>'string'),
			array('name'=>'feeinfo.allyefee','title'=>'当月业绩','type'=>'string'),
			array('name'=>'feeinfo.newkqfee','title'=>'出勤奖励','type'=>'string'),
			array('name'=>'feeinfo.newbzfee','title'=>'补助绩效','type'=>'string'),
			array('name'=>'feeinfo.newyjfee','title'=>'业绩绩效','type'=>'string'),
			array('name'=>'feeinfo.newtcfee','title'=>'提成工资','type'=>'string'),
			array('name'=>'feeinfo.bufee','title'=>'补费','type'=>'string'),
			array('name'=>'feeinfo.newgzfee','title'=>'工资总额','type'=>'string'),
			array('name'=>'feeinfo.she1fee','title'=>'社保-养老','type'=>'string'),
			array('name'=>'feeinfo.she2fee','title'=>'社保-医疗','type'=>'string'),
			array('name'=>'feeinfo.she3fee','title'=>'社保-失业','type'=>'string'),
			array('name'=>'feeinfo.gjjfee','title'=>'公积金','type'=>'string'),
			array('name'=>'fee','title'=>'应付工资','type'=>'string'),
			array('name'=>'feeinfo.newsuifee','title'=>'应扣个税','type'=>'string'),
			array('name'=>'feeinfo.morekoufee','title'=>'应扣费用','type'=>'string'),
			array('name'=>'feeinfo.moreaddfee','title'=>'额外加费','type'=>'string'),
			array('name'=>'payfee','title'=>'实发工资','type'=>'string'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'feelog_status'),
			array('name'=>'upworkerid','title'=>'审批人','type'=>'select','options'=>'workers'),
			array('name'=>'pay_time','title'=>'发放时间','type'=>'time'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'time'),
		),'action'=>array(
			array('type'=>'modal','action'=>'jy_yxgz/feelog/sheck','title'=>'审核','show'=>array('status'=>0)),
			array('type'=>'modal','action'=>'jy_yxgz/feelog/kaodays','title'=>'考勤天数','show'=>array('status'=>0)),
			array('type'=>'modal','action'=>'jy_yxgz/feelog/newsuifee','title'=>'应扣个税','show'=>array('status'=>0)),
			array('type'=>'modal','action'=>'jy_yxgz/feelog/fafee','title'=>'发放','show'=>array('status'=>array(1,3))),
			array('type'=>'modal','action'=>'jy_yxgz/feelog/morefeelog/','title'=>'扣费明细'),
			array('type'=>'href','action'=>'jy_yxgz/feelog/bufee','title'=>'补费','show'=>array('status'=>array(0,1,2,3))),
		)),
		'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'员工姓名','name'=>'title','help'=>''),
			array('name'=>'status','width'=>'15','title'=>'状态','type'=>'radio','options'=>'feelog_status'),
			array('name'=>'y','width'=>15,'title'=>'年份','type'=>'radio','options'=>'ys'),
			array('name'=>'m','width'=>15,'title'=>'月份','type'=>'radio','options'=>'months'),
		),
	);
	$return['workers']=pdo_getall('jy_yxw_worker',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['juese']=$this->user_juese;
	$return['htmls']=$htmls;
	$nowy=date('Y');
	$y1=$nowy-2;
	$y2=$nowy-1;
	$return['ys']=array(
		$y1=>$y1.'年',
		$y2=>$y2.'年',
		$nowy=>$nowy.'年',
	);
	$return['months']=array(
		'01'=>'1月',
		'02'=>'2月',
		'03'=>'3月',
		'04'=>'4月',
		'05'=>'5月',
		'06'=>'6月',
		'07'=>'7月',
		'08'=>'8月',
		'09'=>'9月',
		'10'=>'10月',
		'11'=>'11月',
		'12'=>'12月',
	);
	exi($return);
}
if($_RQ['op']=='newsuifee'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$feeinfo=$this->model('model')->getfee($postdata['feeinfo'],$postdata);
		$data=array(
			'kaoqingday'=>trim($postdata['kaoqingday']),
			'fee'=>$feeinfo['newfee'],
			'payfee'=>$feeinfo['newpayfee'],
			'feeinfo'=>ijson_encode($feeinfo),
		);
		$id=intval($postdata['id']);
		if($id){
			pdo_update('jy_yxgz_feelog',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			exi('处理成功！','','list');
		}else{
			exi('没有找到处理的');
	}
	}
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	$item['feeinfo']=json_decode($item['feeinfo'],true);
	$item['workertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['workerid'],'uniacid'=>$_SESSION['uniacid']),'title');
	$return['item']=$item;
	$return['htmls']=array(
			'type'=>'edit',
			'edit'=>array(
				array('name'=>'workertitle','title'=>'员工','type'=>'copy'),
				array('name'=>'feeinfo.newsuifee','title'=>'应扣个税','type'=>'string'),
			),
	);
	exi($return);
}
if($_RQ['op']=='kaodays'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$feeinfo=json_decode($postdata['feeinfo'],true);
		$feeinfo=$this->model('model')->getfee($feeinfo,$postdata);
		$data=array(
			'kaoqingday'=>trim($postdata['kaoqingday']),
			'fee'=>$feeinfo['newfee'],
			'payfee'=>$feeinfo['newpayfee'],
			'feeinfo'=>ijson_encode($feeinfo),
		);
		$id=intval($postdata['id']);
		if($id){
			pdo_update('jy_yxgz_feelog',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			exi('处理成功！','','list');
		}else{
			exi('没有找到处理的');
	}
	}
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	$item['workertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['workerid'],'uniacid'=>$_SESSION['uniacid']),'title');
	$return['item']=$item;
	$return['htmls']=array(
			'type'=>'edit',
			'edit'=>array(
				array('name'=>'workertitle','title'=>'员工','type'=>'copy'),
				array('name'=>'allkaoqingday','title'=>'全勤天数','type'=>'copy'),
				array('name'=>'kaoqingday','title'=>'实际考勤天数','type'=>'string'),
			),
	);
	exi($return);
}
if($_RQ['op']=='sheck'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array(
			'status'=>trim($postdata['status']),
			'failremark'=>trim($postdata['failremark']),
		);
		$id=intval($postdata['id']);
		if($id){
			pdo_update('jy_yxgz_feelog',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			exi('审批成功！','','list');
		}else{
			exi('没有找到审批');
	}
	}
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	$item['workertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['workerid'],'uniacid'=>$_SESSION['uniacid']),'title');
	$return['item']=$item;
	$return['htmls']=array(
			'type'=>'edit',
			'edit'=>array(
				array('name'=>'workertitle','title'=>'员工','type'=>'copy'),
				array('name'=>'status','title'=>'审批状态','type'=>'radio','options'=>'status'),
				array('name'=>'failremark','title'=>'审核不通过原因','type'=>'text','show'=>array('status'=>2)),
			),
	);
	$return['status']=array('待审核','审核通过','审核不通过');
	exi($return);
}
if($_RQ['op']=='bufee'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$bufee=0;
		foreach($postdata['bufees'] as $bf){
			if(!$bf['fee'] || $bf['fee']<1){
				exi($bf['title'].'-补费必须大于0！');
			}
			$bufee +=$bf['fee'];
		}
		$postdata['feeinfo']['bufee']=$bufee;
		$feeinfo=$this->model('model')->getfee($postdata['feeinfo'],$postdata);
		$data=array(
			'fee'=>$feeinfo['newfee'],
			'payfee'=>$feeinfo['newpayfee'],
			'bufees'=>ijson_encode($postdata['bufees']),
			'feeinfo'=>ijson_encode($feeinfo),
		);
		$id=intval($postdata['id']);
		if($id){
			pdo_update('jy_yxgz_feelog',$data,array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			exi('操作成功！','','goback');
		}else{
			exi('没有找到薪资单');
	}
	}
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	$item['bufees']=json_decode($item['bufees'],true);
	$item['feeinfo']=json_decode($item['feeinfo'],true);
	$item['workertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['workerid'],'uniacid'=>$_SESSION['uniacid']),'title');
	$return['item']=$item;
	$return['htmls']=array(
			'type'=>'edit',
			'edit'=>array(
				array('name'=>'workertitle','title'=>'员工','type'=>'copy'),
				array(
							'type'=>'array',
							'name'=>'bufees',
							'title'=>'补费项目',
							'add_tip'=>'添加一个补费类型',
								'list'=>array(
									array('type'=>'string','name'=>'title','title'=>'补费项目'),
									array('type'=>'string','name'=>'fee','title'=>'补费金额'),
									
								),
								'details'=>array(
									array('type'=>'string','name'=>'title','title'=>'补费项目','help'=>'比如后期的外勤补助，话补，餐补，其他等'),
									array('type'=>'string','name'=>'fee','title'=>'补费金额'),
									
								)
				)
			),
	);
	exi($return);
}
if($_RQ['op']=='fafee'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		pdo_update('jy_yxgz_feelog',array('status'=>4),array('id'=>$postdata['id'],'uniacid'=>$_SESSION['uniacid']));
		exi('发放成功！','','/feelog/');
	}
	$id=intval($_RQ['id']);
	$item=pdo_get('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	$item['feeinfo']=json_decode($item['feeinfo'],true);
	$return['item']=$item;
	$return['htmls']=array(
			'type'=>'edit',
			'title'=>'发放薪资',
			'edit'=>array(
				array('name'=>'workerid','title'=>'员工','type'=>'select','read'=>true,'options'=>'workers'),
				array('name'=>'groupid','title'=>'部门','type'=>'select','read'=>true,'options'=>'groups'),
				array('name'=>'group2id','title'=>'职位','type'=>'select','read'=>true,'options'=>'groups'),
				array('name'=>'allkaoqingday','title'=>'总考勤天数','type'=>'copy'),
				array('name'=>'kaoqingday','title'=>'出勤天数','type'=>'copy'),
				array('name'=>'feeinfo.jifee','title'=>'基本工资','type'=>'copy'),
				array('name'=>'feeinfo.newkqfee','title'=>'出勤奖励','type'=>'copy'),
				array('name'=>'feeinfo.newbzfee','title'=>'补助绩效','type'=>'copy'),
				array('name'=>'feeinfo.newyjfee','title'=>'业绩绩效','type'=>'copy'),
				array('name'=>'feeinfo.newtcfee','title'=>'提成工资','type'=>'copy'),
				array('name'=>'feeinfo.bufee','title'=>'补费','type'=>'copy'),
				array('name'=>'feeinfo.newgzfee','title'=>'工资总额','type'=>'copy'),
				array('name'=>'feeinfo.she1fee','title'=>'社保-养老','type'=>'copy'),
				array('name'=>'feeinfo.she2fee','title'=>'社保-医疗','type'=>'copy'),
				array('name'=>'feeinfo.she3fee','title'=>'社保-失业','type'=>'copy'),
				array('name'=>'feeinfo.gjjfee','title'=>'公积金','type'=>'copy'),
				array('name'=>'fee','title'=>'应付工资','type'=>'copy'),
				array('name'=>'feeinfo.newsuifee','title'=>'应扣个税','type'=>'copy'),
				array('name'=>'feeinfo.morekoufee','title'=>'应扣费用','type'=>'copy'),
				array('name'=>'feeinfo.moreaddfee','title'=>'额外加费','type'=>'copy'),
				array('name'=>'payfee','title'=>'实发工资','type'=>'copy'),
			),
	);
	$return['status']=array('待审核','审核通过','审核不通过');
	$return['workers']=pdo_getall('jy_yxw_worker',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['juese']=$this->user_juese;
	exi($return);
}
if($_RQ['op']=='uplog'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->model('model')->upfeelog($postdata['day'],$postdata['type'],$postdata['workerid']);
		exi('操作成功！','','/feelog/');
	}
	$month = date('Y-m',strtotime('-1 month'));
	$day=$this->model('model')->getkqdays($month);
	$return['item']=array('day'=>$day,'type'=>0);
	$return['htmls']=array(
			'type'=>'edit',
			'title'=>'生成上月薪资表',
			'edit'=>array(
				array('title'=>'【温馨提示】：确定生成上月（'.$month.'月）薪资表？生成薪资表后，员工/主管可以手机端录入考勤次数等！最终会生成考勤奖励！','type'=>'tip'),
				array('type'=>'unitstring','unit'=>'天','name'=>'day','title'=>'（'.$month.'月）考勤天数'),
				array('type'=>'radio','name'=>'type','title'=>'类型','options'=>'type'),
				array('name'=>'workerid','title'=>'员工','type'=>'select','options'=>'workers','show'=>array('type'=>1)),
			),
	);
	$return['status']=array('待审核','审核通过','审核不通过');
	$return['type']=array('全员','个人');
	$return['workers']=pdo_getall('jy_yxw_worker',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	exi($return);
}
if($_RQ['op']=='del'){
	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_yxgz_feelog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
			}
		}
	}
	exi('删除成功！');
}
if($_RQ['op']=='morefeelog'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['title']){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$params2['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
		$workerid=pdo_getall('jy_yxw_worker',$params2,array('title','id'),'id');
		if($workerid){
			$workerid=array_keys($workerid);
		}else{
			$workerid=-1;
		}
		$params['workerid']=$workerid;
	}
	if($_RQ['id']){
		$workerid=pdo_getcolumn('jy_yxgz_feelog',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_RQ['id']),'workerid');
		$params['workerid']=$workerid;
		$return['params']['id']=$_RQ['id'];
	}
	if($_RQ['status']){
		$params['status']=$_RQ['status'];
		$return['params']['status']=$_RQ['status'];
	}
	if(!empty($_RQ['y']) && !empty($_RQ['m'])){
		$yuestart = mktime(0,0,0,$_RQ['m'],1,$_RQ['y']);
		$yueend = mktime(0,0,0,$_RQ['m']+1,1,$_RQ['y']);
		$params['pay_time between']=array($yuestart,$yueend);
	}elseif(!empty($_RQ['y'])){
		$yuestart = mktime(0,0,0,1,1,$_RQ['y']);
		$yueend = mktime(0,0,0,1,1,$_RQ['y']+1);
		$params['pay_time between']=array($yuestart,$yueend);
	}
	if(!empty($_RQ['y'])){
		$return['params']['y']=$_RQ['y'];
	}
	if(!empty($_RQ['m'])){
		$return['params']['m']=$_RQ['m'];
	}
	$orderby=array();
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_yxgz_morefeelog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	foreach($list as &$item){
	}
	$return['list']=$list?$list:array();
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'workerid','title'=>'员工','type'=>'select','options'=>'workers'),
			array('name'=>'price','title'=>'额度','type'=>'string'),
			array('name'=>'remark','title'=>'费用说明','type'=>'string'),
			array('name'=>'isadd','title'=>'费用类型','type'=>'radio','options'=>'isadd'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'morefeelog_status'),
			array('name'=>'upworkerid','title'=>'审批人','type'=>'select','options'=>'workers'),
			array('name'=>'month','title'=>'月份','type'=>'string'),
			array('name'=>'createtime','title'=>'创建时间','type'=>'time'),
		),'action'=>array(
			array('type'=>'modal','action'=>'jy_yxgz/morefeelog/chgange','title'=>'修改费用'),
		)),
		'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'员工姓名','name'=>'title','help'=>''),
			array('name'=>'y','width'=>15,'title'=>'年份','type'=>'radio','options'=>'ys'),
			array('name'=>'m','width'=>15,'title'=>'月份','type'=>'radio','options'=>'months'),
		),
	);
	$return['workers']=pdo_getall('jy_yxw_worker',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['isadd']=array('扣除','增加');
	$nowy=date('Y');
	$y1=$nowy-2;
	$y2=$nowy-1;
	$return['ys']=array(
		$y1=>$y1.'年',
		$y2=>$y2.'年',
		$nowy=>$nowy.'年',
	);
	$return['months']=array(
		'01'=>'1月',
		'02'=>'2月',
		'03'=>'3月',
		'04'=>'4月',
		'05'=>'5月',
		'06'=>'6月',
		'07'=>'7月',
		'08'=>'8月',
		'09'=>'9月',
		'10'=>'10月',
		'11'=>'11月',
		'12'=>'12月',
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='export'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['title']){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$params2['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
		$workerid=pdo_getall('jy_yxw_worker',$params2,array('title','id'),'id');
		if($workerid){
			$workerid=array_keys($workerid);
		}else{
			$workerid=-1;
		}
		$params['workerid']=$workerid;
	}
	if($_RQ['status']){
		$params['status']=$_RQ['status'];
		$return['params']['status']=$_RQ['status'];
	}
	if(!empty($_RQ['y']) && !empty($_RQ['m'])){
		$params['month']=$_RQ['y'].'-'.$_RQ['m'];
	}elseif(!empty($_RQ['y'])){
		$params['month like']=$_RQ['y'];
	}
	if(!empty($_RQ['y'])){
		$return['params']['y']=$_RQ['y'];
	}
	if(!empty($_RQ['m'])){
		$return['params']['m']=$_RQ['m'];
	}
	$order=pdo_getall('jy_yxgz_feelog',$params);
	$status=array('1'=>'待发货','2'=>'待收货','3'=>'已完成','4'=>'已关闭');
	$paytype=array('wechat'=>'微信支付','credit'=>'余额支付');
	$ispay=array('0'=>'未支付','1'=>'已支付');
	foreach($order as &$item){
		$item['feeinfo']=json_decode($item['feeinfo'],true);
		$item['feeinfo_jifee']=$item['feeinfo']['jifee'];
		$item['feeinfo_newkqfee']=$item['feeinfo']['newkqfee'];
		$item['feeinfo_newbzfee']=$item['feeinfo']['newbzfee'];
		$item['feeinfo_newyjfee']=$item['feeinfo']['newyjfee'];
		$item['feeinfo_newtcfee']=$item['feeinfo']['newtcfee'];
		$item['feeinfo_bufee']=$item['feeinfo']['bufee'];
		$item['feeinfo_newgzfee']=$item['feeinfo']['newgzfee'];
		$item['feeinfo_she1fee']=$item['feeinfo']['she1fee'];
		$item['feeinfo_she2fee']=$item['feeinfo']['she2fee'];
		$item['feeinfo_she3fee']=$item['feeinfo']['she3fee'];
		$item['feeinfo_gjjfee']=$item['feeinfo']['gjjfee'];
		$item['feeinfo_newsuifee']=$item['feeinfo']['newsuifee'];
		$item['feeinfo_morekoufee']=$item['feeinfo']['morekoufee'];
		$item['feeinfo_moreaddfee']=$item['feeinfo']['moreaddfee'];
		$item['statustitle']=$this->feelog_status[$item['status']];
		$item['workertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['workerid'],'uniacid'=>$_SESSION['uniacid']),'title');
		$item['upworkertitle']=pdo_getcolumn('jy_yxw_worker',array('id'=>$item['upworkerid'],'uniacid'=>$_SESSION['uniacid']),'title');
		$item['pay_time']=$item['pay_time']?date('Y-m-d H:i:s',$item['pay_time']):'';
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
	}
	$header=array(
		'workertitle'=>'员工',
		'groupidtitle'=>'角色',
		'allkaoqingday'=>'总考勤天数',
		'kaoqingday'=>'出勤天数',
		'feeinfo_jifee'=>'基本工资',
		'feeinfo_newkqfee'=>'出勤奖励',
		'feeinfo_newbzfee'=>'补助绩效',
		'feeinfo_newyjfee'=>'业绩绩效',
		'feeinfo_newtcfee'=>'提成工资',
		'feeinfo_bufee'=>'补费',
		'feeinfo_newgzfee'=>'工资总额',
		'feeinfo_she1fee'=>'社保-养老',
		'feeinfo_she2fee'=>'社保-医疗',
		'feeinfo_she3fee'=>'社保-失业',
		'feeinfo_gjjfee'=>'公积金',
		'fee'=>'应付工资',
		'feeinfo_newsuifee'=>'应扣个税',
        'feeinfo_morekoufee'=>'应扣费用',
        'feeinfo_moreaddfee'=>'额外加费',
		'payfee'=>'实发工资',
		'statustitle'=>'状态',
		'upworkertitle'=>'审批人',
		'pay_time'=>'发放时间',
		'createtime'=>'创建时间',
	);
	cfc('tools')->export2excel($header,$order,'薪资表');
}